<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 6+*Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <f:metadata>
        <f:event type="preRenderView" listener="#{sessionManaged.validar_session('wfrmFormulario')}"/>
    </f:metadata>

    <body>

    <ui:composition template="./../../../template.xhtml">
        <ui:define name="main_content">
            <div align="left">
                <ui:include src="/web-pages/OTROS/HELP/wfrmHelp_mtto.xhtml">
                    <ui:param name="toolBarWidth" value="750"/>
                    <ui:param name="toolBarTitleWidth" value="700"/>
                    <ui:param name="title" value="Formulario"/>
                </ui:include>
                <p:panel header="Informaci&oacute;n de Formulario" style="width:750px" >
                    <ui:include src="/web-pages/OTROS/wfrmMensaje.xhtml"/>

                    <h:form id="formulario" >
                        <h:panelGrid id="pFormulario" columns="4" cellpadding="3" style="width:inherit">

                            <h:outputText value="Modulo" />
                            <h:selectOneMenu value="#{formularioManaged.selectedFormulario.codigo_m}" style="width: 285px">
                                <f:selectItems value="#{formularioManaged.modulos}" var="cmbModulo" itemLabel="#{cmbModulo.nombre_m}" itemValue="#{cmbModulo.codigo_m}" />
                            </h:selectOneMenu>
                            <h:outputText value=""/><h:outputText value=""/>

                            <h:outputText value="Nombre" />
                            <p:inputText value="#{formularioManaged.selectedFormulario.nombre_f}" style="width: 285px" />

                            <h:outputText value="Nombre Form" />
                            <p:inputText value="#{formularioManaged.selectedFormulario.nombre_form_f}" style="width: 285px" />
                        </h:panelGrid>

                        <div align="center">
                            <h:panelGrid id="cmdButtones" columns="2" cellpadding="5" style="width:inherit">
                                <p:commandButton value="#{sms.guardar}" onclick="cmdConfirm.show()" image="ui-icon ui-icon-check"/>
                                <p:commandButton value="#{sms.limpiar}" actionListener="#{limpiarManaged.limpiar}" update="formulario:pFormulario grid:table"/>
                                <p:confirmDialog message="#{sms.iAlmacenada}" header="#{sms.guardar}" severity="alert" widgetVar="cmdConfirm">
                                    <p:commandButton value="Si" actionListener="#{formularioManaged.mantenimientoFormulario}" update="grid:table formulario:pFormulario mensaje" oncomplete="cmdConfirm.hide()" />
                                    <p:commandButton value="No" onclick="cmdConfirm.hide()" />
                                </p:confirmDialog>
                            </h:panelGrid>
                        </div>
                    </h:form>
                    <h:form id="grid">
                        <p:panel header="Datos de M&oacute;dulo" style="width: inherit" >
                            <f:facet name="header">
                                <h:outputText value="Datos de Formularios"/> &nbsp;
                                <p:commandButton image="ui-icon ui-icon-search" actionListener="#{formularioManaged.fillGrid}" update="grid:table mensaje" title="Buscar Formularios"/>
                            </f:facet>
                            <p:dataTable id="table" value="#{formularioManaged.formularios}" var="row" rows="15"
                                         paginator="true" paginatorPosition="bottom" selectionMode="single" selection="#{formularioManaged.selectedFormulario}"
                                         emptyMessage="#{sms.TableEmptyMessage}" onRowSelectUpdate="formulario:pFormulario">
                                <f:facet name="header"><h:outputText value="Lista de Formularios" /></f:facet>
                                <p:column headerText="M&oacute;dulo" filterBy="#{row.nombre_m}" filterMatchMode="contains" sortBy="#{row.nombre_m}">
                                    <h:outputText value="#{row.nombre_m}"/>
                                </p:column>
                                <p:column headerText="Formulario" filterBy="#{row.nombre_f}" filterMatchMode="contains" sortBy="#{row.nombre_f}">
                                    <h:outputText value="#{row.nombre_f}"/>
                                </p:column>
                            </p:dataTable>
                        </p:panel>
                    </h:form>
                </p:panel>
            </div>
        </ui:define>
    </ui:composition>

</body>
</html>
